home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / w / word_perfect / wordperfectv5.0c.dms / wordperfectv5.0c.adf / pscript.ps < prev    next >
Text File  |  1989-10-31  |  7KB  |  231 lines

  1. % WordPerfect Virtual Printer Interface Program Version 3.0 Amiga
  2. % A PostScript Program to Emulate a Microspace Printer
  3. % (C)Copyright 1986,1988 WordPerfect Corporation - All Rights Reserved
  4.  
  5. % NOTE - this program can be made to remain persistent in memory on an Apple
  6. % LaserWriter until the power is shut off.  To do this remove the '%' from the
  7. % beginning of the line below that starts with the word 'serverdict', add a
  8. % CTRL-D to the end of the file, and enter the LaserWriter password in place of
  9. % the 0 in the line below if the default password has been changed.
  10.  
  11. % serverdict begin 0 exitserver
  12.  
  13. /PtrEmDict 80 dict def
  14. /PtrEmulate { PtrEmDict begin printfile end }def
  15.  
  16. PtrEmDict begin
  17. /tmpstring 1 string def
  18.  
  19. /getch
  20. { currentfile read pop
  21. } bind def
  22.  
  23. /putch
  24. { dup 36 eq { pop readhex } if        % if '\', read hex numbernumber
  25.   dup 255 gt { pop 63 } if
  26.   tmpstring dup 0 4 -1 roll put show    % output char and round
  27.   currentpoint exch            % to nearest divice pixel
  28.   .501 add floor exch moveto        % (add .501 instead of .5 toavoid
  29. }bind def                    %  rounding glitch)
  30.  
  31. /readnum    % read any length ASCII number - terminated bynon-digit
  32. { 0
  33.   { getch dup dup 48 lt exch 57 gt or { pop exit } if
  34.     48 sub exch 10 mul add
  35.   }loop
  36. }bind def
  37.  
  38. /readhex    % read hex number
  39. { gethex 16 mul gethex add 
  40. }bind def
  41.  
  42. /gethex    % read a number and convert it to $0-$F
  43. { getch 48 sub dup 10 gt { 7 sub } if 
  44. }bind def
  45.  
  46. /printfile
  47. { initjob
  48.   { getch    % get a char
  49.     dup 32 lt            % command?
  50.     {load exec}            %  yes, execute it
  51.     {putch}            %  no, output char
  52.     ifelse
  53.     eod? {exit} if
  54.   }loop
  55. }bind def
  56.  
  57. /initjob
  58. {/eod? false def
  59.  /manfeed? false def
  60.  /orient 49 def
  61.  /res readnum def        % device resolution in DPI
  62.  /pgwid readnum def        % page width in dots
  63.  /pglen readnum def        % page length in dots
  64. }bind def
  65.  
  66. /delay    % 5 sec delay
  67. { usertime 5000 add {dup usertime lt {pop exit} if} loop }bind
  68. def
  69.  
  70. /newcodes [    % foreign char encodings
  71. 16#80 /Agrave        16#81 /Aacute        16#82 /Acircumflex
  72. 16#83 /Atilde        16#84 /Adieresis    16#85 /Aring
  73. 16#86 /Ccedilla        16#87 /Egrave        16#88 /Eacute
  74. 16#89 /Ecircumflex     16#8A /Edieresis    16#8B /Igrave
  75. 16#8C /Iacute        16#8D /Icircumflex    16#8E /Idieresis
  76. 16#90 /Ntilde        16#91 /Ograve        16#92 /Oacute
  77. 16#93 /Ocircumflex    16#94 /Otilde        16#95 /Odieresis
  78. 16#96 /Ugrave        16#97 /Uacute        16#98 /Ucircumflex
  79. 16#99 /Udieresis    16#9A /Yacute        16#9C /agrave
  80. 16#9D /aacute        16#9E /acircumflex    16#9F /atilde
  81. 16#A0 /adieresis    16#A6 /aring        16#8F /ccedilla
  82. 16#AC /egrave        16#AD /eacute        16#AE /ecircumflex
  83. 16#AF /edieresis    16#B0 /igrave        16#B1 /iacute
  84. 16#B2 /icircumflex    16#B3 /idieresis    16#B9 /oacute
  85. 16#BA /ograve        16#BC /oacute        16#BD /ocircumflex
  86. 16#AA /otilde        16#CD /odieresis    16#CE /ugrave
  87. 16#D0 /uacute        16#E8 /ucircumflex    16#EA /udieresis
  88. 16#F8 /yacute        16#FA /ydieresis
  89. ] def
  90.  
  91. /reencdict 12 dict def
  92. /ReEncode            % reencodes a font
  93. {reencdict begin
  94.  /newname exch def /basename exch def
  95.  /basedict basename findfont def
  96.  /newfont basedict maxlength dict def
  97.  basedict
  98.  { exch dup /FID ne
  99.    { dup /Encoding eq
  100.      { exch dup length array copy newfont 3 1 roll put }
  101.      { exch newfont 3 1 roll put } ifelse
  102.    }{ pop pop }ifelse
  103.  } forall
  104.  newfont /FontName newname put
  105.  newcodes aload pop newcodes length 2 idiv
  106.  { newfont /Encoding get 3 1 roll put } repeat
  107.  newname newfont definefont pop
  108.  end    % of reencdict
  109. }bind def
  110.  
  111. 0 %NULLs are ignored
  112.  {}bind def
  113. 1 %SOP
  114.  {pglen 4200 eq {legal} if
  115.   72 res div dup scale            % scale to new dpi (must doeach page)
  116.   orient 50 eq
  117.   { pgwid 0 translate 90 rotate        % landscape
  118.     pglen pgwid /pglen exch def
  119.     /pgwid exch def
  120.   } if
  121.   orient 51 eq
  122.   { pgwid pglen translate
  123.     180 rotate                % reverse portrait
  124.   } if
  125.   orient 52 eq
  126.   { 0 pglen translate 270 rotate    % reverse landscape
  127.     pglen pgwid /pglen exch def
  128.     /pgwid exch def
  129.   } if
  130.   0 pglen moveto            % move to top left of page
  131.  }bind def
  132. 2 %EOD
  133.  { /eod? true def }bind def
  134. 5 %MS
  135.  { readnum 0 rmoveto }bind def
  136. 6 %RMS
  137.  { readnum neg 0 rmoveto }bind def
  138. 7 %CR
  139.  { 0 currentpoint exch pop moveto }bind def
  140. 8 %manual feed this page
  141.  { /manfeed? true def }bind def
  142. 9 %VMI
  143.  { /vmi readnum def }bind def
  144. 10 %LF
  145.  { currentpoint vmi sub moveto }bind def
  146. 11 %RLF
  147.  { currentpoint vmi add moveto }bind def
  148. 12 %EOP
  149.  { manfeed?
  150.    { delay statusdict /manualfeed true put delay
  151.      showpage statusdict /manualfeed false put
  152.      /manfeed? false def
  153.    }{ showpage }ifelse
  154.  }bind def
  155. 14 %set number of copies
  156.  { /#copies readnum store }bind def
  157. 15 %set new orientation  1=PORT  2=LAND  3=RevPORT  4=RevLAND
  158.  { /orient getch def }bind def
  159. 16 %change fonts
  160.  { getch load exec        % get font id and do its proc
  161.   dup FontDirectory exch known            % is reencoded nameknown?
  162.   { exch pop }                    %  yes, get rid of long name
  163.   { dup 3 1 roll ReEncode } ifelse        %  no, reencode it
  164.   findfont
  165.   readnum dup /fsize exch def
  166.   scalefont setfont
  167.  }bind def
  168. 18 %shift to symbol font for one char only
  169.  { currentfont
  170.    /Symbol findfont fsize scalefont setfont
  171.    getch putch setfont
  172.  }bind def
  173. 21 %start of auto underlining
  174.  { /ulfont currentfont def
  175.    /ulstart currentpoint pop def
  176.  }bind def
  177. 22 %end of auto underlining
  178.  { currentfont ulfont setfont
  179.    currentpoint ulstart exch moveto ulstart sub cvi    % width tounderline
  180.    /ulsize tmpstring dup 0 95 put
  181.     stringwidth pop .501 add floor cvi def
  182.    dup ulsize idiv { 95 putch } repeat
  183.    cvi ulsize mod dup 0 ne { ulsize sub 0 rmoveto 95 putch } { pop } ifelse
  184.    setfont
  185.  }bind def
  186. 23 %select paper tray
  187.  { statusdict begin
  188.    readnum
  189.    setpapertray  %0,1,or 2 selects upper, lower, or limitless
  190.    end
  191.  }bind def
  192.  
  193. % FONTS
  194. 65 {/Helvetica            /helv    }def    %A
  195. 66 {/Helvetica-Oblique        /helvo    }def    %B
  196. 67 {/Helvetica-Bold        /helvb    }def    %C
  197. 68 {/Helvetica-BoldOblique    /helvbo    }def    %D
  198. 69 {/Times-Roman        /tims    }def    %E
  199. 70 {/Times-Italic        /timsi    }def    %F
  200. 71 {/Times-Bold            /timsb    }def    %G
  201. 72 {/Times-BoldItalic        /timsbi    }def    %H
  202. 73 {/AvantGarde-Book        /avgb    }def    %I
  203. 74 {/AvantGarde-BookOblique    /avgbo    }def    %J
  204. 75 {/AvantGarde-Demi        /avgd    }def    %K
  205. 76 {/AvantGarde-DemiOblique    /avgdo    }def    %L
  206. 77 {/Bookman-Demi        /bookd    }def    %M
  207. 78 {/Bookman-DemiItalic        /bookdi    }def    %N
  208. 79 {/Bookman-Light        /bookl    }def    %O
  209. 80 {/Bookman-LightItalic    /bookli    }def    %P
  210. 81 {/Helvetica-Narrow        /hlvn    }def    %Q
  211. 82 {/Helvetica-Narrow-Oblique    /hlvno    }def    %R
  212. 83 {/Helvetica-Narrow-Bold    /hlvnb    }def    %S
  213. 84 {/Helvetica-Narrow-BoldOblique /hnbo    }def    %T
  214. 85 {/NewCenturySchlbk-Roman    /ncsr    }def    %U
  215. 86 {/NewCenturySchlbk-Italic    /ncsi    }def    %V
  216. 87 {/NewCenturySchlbk-Bold    /ncsb    }def    %W
  217. 88 {/NewCenturySchlbk-BoldItalic /ncsbi    }def    %X
  218. 89 {/Palatino-Roman        /palr    }def    %Y
  219. 90 {/Palatino-Italic        /pali    }def    %Z
  220. 97 {/Palatino-Bold        /palb    }def    %a
  221. 98 {/Palatino-BoldItalic    /palbi    }def    %b
  222. 99 {/ZapfChancery-MediumItalic    /zchmi    }def    %c
  223. 117 {/Courier            /cr    }def    %u
  224. 118 {/Courier-Oblique        /cro    }def    %v
  225. 119 {/Courier-Bold        /crb    }def    %w
  226. 120 {/Courier-BoldOblique    /crbo    }def    %x
  227. 121 {/Symbol        /Symbol        }def    %y
  228. 122 {/ZapfDingbats    /ZapfDingbats    }def    %z
  229.  
  230. end    % of PtrEmDict
  231.